<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let obj = {
            name: '小红',
            age: '2'
        }
        for (let k in obj) {
            // 打印的对象的属性名：
            console.log(k);
            // k是个变量 for in 循环要拿到对象的属性值 只能通过对象[] 变量来解析
            console.log(obj[k]);
        }
    </script>
</body>

</html>